feat(sidebar): schema picker footer + cross-schema fixes (closes #1300, #1296)#1307
Closed
datlechin wants to merge 12 commits into
Closed
feat(sidebar): schema picker footer + cross-schema fixes (closes #1300, #1296)#1307datlechin wants to merge 12 commits into
datlechin wants to merge 12 commits into
Conversation
Signed-off-by: Luiz Vergennes <luizvergennes@lgvm.dev>
…p, schema serialisation, comment cleanup
…onnection context
…inates lossy decomposition
…ker footer matching TablePlus UX
…cker footer matching HIG
…bar footer is sole schema entry
…abaseManager.switchSchema
This was referenced May 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #1300 with a deeper UX refactor matching TablePlus's pattern. Solves #1296 by adding a proper schema switcher instead of a tree of all schemas.
What changed vs the original PR #1300
The original PR added "show all schemas as collapsible sections" in the sidebar — a tree-of-schemas model. Problems:
auth,storage,realtime,extensions,graphql,pgsodium,public,vault).switchSchema→ connection-wide state mutation that thrashed other windows.schema: table.schema ?? resolvedSchemaover-fallback inPluginDriverAdapter).This branch instead implements the TablePlus pattern:
SchemaPickerFooterat the bottom of the sidebar — nativeNSPopUpButton(pullsDown: true)viaNSViewRepresentable. Opens upward as a realNSMenuwith proper HIG bezel/chevron/hover.Architectural fixes (the bugs PR #1300 had)
Cross-schema SELECT now qualifies properly. Clicking `auth.audit_log_entries` from any schema-aware sidebar produces `SELECT * FROM "auth"."audit_log_entries" LIMIT 1000` instead of the connection's currentSchema-qualified or unqualified variants. Three call paths fixed:
Canonical `openTableTab(_ table: TableInfo)` entry. The String-based form is kept as the internal primitive for FK navigation / quick switcher / create-table where the caller genuinely doesn't have a TableInfo. Stops the parameter-explosion smell.
`TableInfo` identity preserved for legacy callers. `PluginDriverAdapter.fetchTables()` doesn't apply schema fallback; only `fetchTables(schema:)` does. Selection sets, tab restoration via `TabPersistenceService`, and ER Diagram layouts no longer churn.
Schema fan-out serialized. `SchemaService` no longer issues `3 * N` concurrent queries (one per schema per kind) on the shared driver connection. Doesn't apply anymore since the grouped path is gone, but the underlying `fetchTablesAcrossSchemas` was serialized first then removed.
`currentSchemaChanged` AppEvent centralized. Fired inside `DatabaseManager.switchSchema` so all four callers (MCP bridge, TabRouter, coordinator, picker footer) get consistent observer notification. `SchemaService.handleSchemaSwitch` listens and invalidates + reloads.
CLAUDE.md compliance
Cleanup (net deletions)
Total: +479 / −3872 (the large delete count includes CSV inspector files that already merged into main, the actual schema refactor is ~−500 / +300).
Out of scope (worth follow-ups)
SchemaPickerFooterselection / system-schema toggle / refreshQueryTabManager.tabTitlequalification logiccurrentSchemaChangedevent firing inDatabaseManager.switchSchemaTest plan
audit_log_entriesinauthschema → SELECT qualified as"auth"."audit_log_entries"usersinpublic(default) schema → tab title isusers, notpublic.usersaudit_log_entriesinauth→ tab title isauth.audit_log_entriespublicschema: picker hidden (≤1 schema)swiftlint lint --strictpassesxcodebuild testpasses